<!-- 添加分类面板 -->
<template>
	<view class="panel" v-show="useCategory.isShowCategoryPanel">
		<view class="container">
			<text class="title">添加分类</text>
			<view class="form">
				<view class="form-item">
					<text class="label">上级分类</text>
					<view class="input-box right-icon">
						<input class="input" type="text" placeholder-style="color: #999;" placeholder="请选择上级分类" />
					</view>
				</view>
				<view class="form-item">
					<text class="label">分类名称</text>
					<view class="input-box">
						<input class="input" type="text" placeholder-style="color: #999;" placeholder="请输入分类名称" />
					</view>
				</view>
				<view class="form-item">
					<text class="label">备注</text>
					<view class="input-box">
						<input class="input" type="text" placeholder-style="color: #999;" placeholder="请输入备注" />
					</view>
				</view>
			</view>
			<view class="btn-group">
				<button class="btn btn-transition-scale95" @click="handleCancel()">取消</button>
				<button class="btn active btn-transition-scale95">确认</button>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { useCategorrStore } from '../store.js';
	
	const useCategory = useCategorrStore();
	
	const handleCancel = () => {
		useCategory.SET_HIDE_CATEGORY_PANEL();
	}
</script>

<style lang="scss" scoped>
	.panel {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.6);
	}

	.container {
		position: absolute;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 574rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 24rpx 30rpx 40rpx;

		.title {
			display: block;
			text-align: center;
			font-weight: bold;
			font-size: 30rpx;
			color: #222222;
			line-height: 1.5;
		}

		.form {
			margin-top: 44rpx;

			&-item {
				display: flex;
				align-items: center;

				&+.form-item {
					margin-top: 36rpx;
				}

				.label {
					flex-shrink: 0;
					width: 120rpx;
					font-size: 28rpx;
					color: #222222;
					text-align: right;
					margin-right: 16rpx;
				}

				.input-box {
					flex-grow: 1;
					
					&.right-icon {
						position: relative;
						
						&::after {
							position: absolute;
							top: 50%;
							right: 10rpx;
							transform: translateY(-50%);
							font-family: 'iconfont';
							content: '\e61a';
							font-size: 28rpx;
							color: #222222;
						}
					}

					.input {
						width: 100%;
						height: 70rpx;
						background: #F9F9F9;
						border-radius: 8rpx;
						padding-left: 20rpx;
						box-sizing: border-box;
					}
				}
			}
		}
	
		.btn-group {
			display: flex;
			justify-content: center;
			margin-top: 52rpx;
			
			.btn {
				width: 224rpx;
				height: 78rpx;
				font-size: 30rpx;
				color: #222222;
				line-height: 78rpx;
				background: #E9E9E9;
				border-radius: 39rpx;
				
				& + .btn {
					margin-left: 44rpx;
				}
				
				&.active {
					color: white;
					background: #FE3333;
				}
			}
		}
	}
</style>